<!--/**
* Author: ganqz
* Date: 2022-08-11 11:04
* Desc: InviteRule
*/
-->
<template>
  <zm-popup mode="bottom" :round="20" closeable v-model="show">
    <view class="invite-rule pd30">
      <view class="fs32 mb30">活动规则</view>
      <info-cell title="活动名称:" :desc="info.name"></info-cell>
      <info-cell title="活动时间:">
        <view slot="desc"> {{ info.startTime }}~{{ info.endTime }} </view>
      </info-cell>
      <info-cell title="任务目标:">
        <view slot="desc">{{ info.targetNum }}人</view>
      </info-cell>
      <info-cell title="活动奖品:" :desc="info.prizeName"></info-cell>
      <info-cell title="奖品总数:">
        <view slot="desc">{{ info.prizeAllNum }}份</view>
      </info-cell>
      <info-cell title="活动限制:" :desc="info.confine"></info-cell>
      <info-cell title="活动说明:">
        <view slot="desc">
          <view class="mb10" v-for="(item, index) in info.explain" :key="index">{{ item }}</view>
        </view>
      </info-cell>
      <view>
        <yy-button plain color="#fff" @click="toShare"> 立即分享 </yy-button>
      </view>
    </view>
  </zm-popup>
</template>
<script>
  import ZmPopup from '@/commons/ZmPopup/index.vue'
  import InfoCell from './cell.vue'
  export default {
    name: 'invite-rule',
    components: { ZmPopup, InfoCell },
    props: {
      value: {
        type: Boolean,
        default: false
      },
      actId: {
        type: String,
        default: ''
      }
    },
    computed: {
      show: {
        set(v) {
          this.$emit('input', v)
        },
        get() {
          return this.value
        }
      }
    },
    mounted() {
      this.getInfo()
    },
    data() {
      return {
        info: {}
      }
    },

    methods: {
      getInfo() {
        uni.$api.activity.getInviteActivityInfo({ activityId: this.actId }).then((res) => {
          this.info = res
        })
      },
      close() {
        this.show = false
      },
      toShare() {
        this.$emit('toShare')
      }
    }
  }
</script>
